// 引入路由组件
// import Login from '@/pages/Login'
// import Register from '@/pages/Register'
// import Detail from '@/pages/Detail'
// import AddCartSuccess from '@/pages/AddCartSuccess'
// import ShopCart from '@/pages/ShopCart'
// import Trade from '@/pages/Trade'
// import Pay from '@/pages/Pay'
// import PaySuccess from '@/pages/PaySuccess'
// import Center from '@/pages/Center'
// import MyOrder from '@/pages/Center/MyOrder'
// import GroupOrder from '@/pages/Center/GroupOrder'
export default [
    {
        name: 'home',
        path: '/home',
        component: ()=>import('@/pages/Home'),
        meta: {
            show: true
        }
    },
    {
        name: "search",
        path: '/search/:keyword?',
        component: ()=>import('@/pages/Search'),
        meta: {
            show: true
        },
        //路由组件能不能传递props数据?
        //布尔值写法:只能传递params参数
        // props:true,
        //对象写法:额外的给路由组件传递一些props
        //props:{a:1,b:2},
        //函数写法:可以params参数、query参数，通过props传递给路由组件
        props: ($route) => {
            return {
                keyword: $route.params.keyword,
                k: $route.query.k
            }
        }
    },
    {
        name: 'login',
        path: '/login',
        component: ()=>import('@/pages/Login'),
        meta: {
            show: false
        }
    },
    {
        name: 'register',
        path: '/register',
        component: ()=>import('@/pages/Register'),
        meta: {
            show: false
        }
    },
    // 重定向，在项目比起来的时候，访问/,立马让他定向到首页
    {
        // path: '*',
        path: '/',
        redirect: '/home'
    },
    {
        name: 'detail',
        path: '/detail/:id',
        component: ()=>import('@/pages/Detail'),
        meta: {
            show: true
        }
    },
    {
        name: 'addcartsuccess',
        path: '/addcartsuccess',
        component: ()=>import('@/pages/AddCartSuccess'),
        meta: {
            show: true
        }
    },
    {
        name: 'shopcart',
        path: '/shopcart',
        component: ()=>import('@/pages/ShopCart'),
        meta: {
            show: true
        }
    }, {
        name: 'trade',
        path: '/trade',
        component: ()=>import('@/pages/Trade'),
        meta: {
            show: true
        }
    }, {
        name: 'pay',
        path: '/pay',
        component: ()=>import('@/pages/Pay'),
        meta: {
            show: true
        }
    },
    {
        name: 'paySuccess',
        path: '/paySuccess',
        component: ()=>import('@/pages/PaySuccess'),
        meta: {
            show: true
        }
    },
    {
        name: 'center',
        path: '/center',
        component: ()=>import('@/pages/Center'),
        meta: {
            show: true
        },
        children: [
            {
                path: 'myOrder',
                component: ()=>import('@/pages/Center/MyOrder')
            }, {
                path: 'groupOrder',
                component: ()=>import('@/pages/Center/GroupOrder'),
            },{
                path: '/center',
                redirect:'/center/myOrder'
            }
        ]
    },


]